#include "lab51.h" // 请不要删除本行头文件，否则检查不通过
#include <stdio.h>
#include <stdlib.h>
int main()
{
    struct part {
        int number;
        char name[NAME_LEN + 1];
        int on_hand;
    } inventory[MAX_PARTS];
 
    int number_parts = 0;
    char code;
    for (;;) {
        printf("Enter operation code:");
        scanf("%c", &code);
        while (getchar() != '\n')
            ;
        switch (code) {
        case 'i':
            insert(inventory, &number_parts);
            break;
        case 's':
            search(inventory, number_parts);
            break;
        case 'u':
            update(inventory, number_parts);
            break;
        case 'p':
            print(inventory, number_parts);
            break;
        case 'q':
            return 0;
        default:
            printf("Illegal code\n");
        }
        printf("\n");
    }
}